import { Code } from './code';
import { Flags } from './flags';
import buffer from '@ohos.buffer';

export interface v2Token {
  version: number;
  serial: string;
  digits: number;
  deviceIdHash: number;
  intervalInSeconds: number;
  expiresAt: Date;
  decryptedSeed: buffer.Buffer;
  decryptedSeedHash: number;
  flags: Flags;
  createdAt?: Date;

  /**
   * Computes a code for this token
   * @param pin The pin to use to generate the code
   * @param date The instant to generate the token for
   * @returns Object containg code details
   */
  computeCode?: (pin?: string | number, date?: Date) => Code;
}